package com.hy.server;

import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousSocketChannel;

/**
 * author: houying
 * date  : 17-6-8
 * desc  :
 */
public class Session {

    private AsynchronousSocketChannel socketChannel;
    private ByteBuffer lastByteBuffer;
    private ByteBuffer readByteBuffer;
    private ByteBuffer writeByteBuffer;

    public Session(AsynchronousSocketChannel socketChannel) {
        this.socketChannel = socketChannel;
        readByteBuffer = ByteBuffer.allocate(1024);
        readByteBuffer.position(0);
        readByteBuffer.limit(readByteBuffer.capacity());
    }

    public void setLastByteBuffer(ByteBuffer byteBuffer) {
        lastByteBuffer = byteBuffer;
    }

    public ByteBuffer getLastByteBuffer() {
        return lastByteBuffer;
    }

    public AsynchronousSocketChannel getSocketChannel() {
        return socketChannel;
    }

    public ByteBuffer getReadByteBuffer() {
        return readByteBuffer;
    }
}
